from fastapi import FastAPI
from dome1.weather_agent import generateWeatherReport
from dome2.promptDome import createNews
from dome3.weatherTool import getWeather
from dome4.story import createStory
from dome5.story import generateToolStory
from dome6.weather_agent import streamWeatherReport

app = FastAPI()


@app.get("/")
def read_root():
    return {"Hello": "World"}


@app.get("/weather/{cityName}")
def queryWeather(cityName: str):
    return generateWeatherReport(cityName)


@app.get("/news/create")
def queryWeather():
    return createNews()


@app.get("/weather-tool")
def toolQueryWeather(question: str = "北京今天天气"):
    return getWeather(question)


@app.get("/generate-story")
def generateStory():
    return createStory()


@app.get("/stream-weather")
def streamWeather():
    return streamWeatherReport()


@app.get("/tool-story")
def toolStory():
    return generateToolStory()


@app.get("/test-func/{name}")
def testFunc(name: str = "小螳螂"):
    func = lambda passengerName, theme, color: f"为{name}编写了一个主题：《{theme}》，颜色：<{color}>的故事"
    return func(name, "小白兔吃萝卜", "黄色")
